//
//  SwiftUIView_Padding_Spacer.swift
//  SwiftUIPractice
//
//  Created by 这是第一节, 还没有完  (external - Project) on 2024/8/28.
//

import SwiftUI

struct SwiftUIView_Padding_Spacer: View {
    var body: some View {
        

        
//        Text("键盘和鼠标")
//            .background(Color.yellow) //这个研究就是包裹文字
//        //这个边距有很多选项, horizontal 这种就是直接前后间距 vertical 这种就是直接上下间距
//            .padding(.vertical, 10)
//            .background(Color.blue) //这个蓝色就是外围的轮廓
        
        
        
        
        // 边距可以叠加
//        Text("键盘和鼠标")
//            .background(Color.yellow)
//            .padding(.vertical, 20)
//            .padding(.leading, 20)
//            .background(Color.blue)
        
        
        

        
//        Text("世界")
//            .font(.largeTitle)
//            .fontWeight(.semibold)
//            .frame(maxWidth: .infinity, alignment: .leading)  //注意,这个 frame 和下面那句 background 互换行效果不一样
////            .background(Color.red)
//            .padding(.leading, 20)
        

     
        
        
//        VStack(alignment: .leading) {
//            Text("你好世界")
//                .font(.largeTitle)
//                .fontWeight(.semibold)
//            Text("Last week I went to Beijing.I went there by train.It was fine with no rain.The sun was shining all the time")
//            //多行文本的居中显示 center, 默认是左对齐
////                .multilineTextAlignment(.leading)
//            
//        }
//        .background(Color.blue)
//        //这次不在 VStack 里面加 间距,而是在外面加, 这里就是 VStack 四周内侧的间距
//        .padding()
//        .background(Color.red)
//        //不让红色太靠近边缘  红色区域距离左右边缘 10
//        .padding(.horizontal, 10)
//        .background(Color.green)

        
        
        VStack(alignment: .leading) {
            Text("你好世界")
                .font(.largeTitle)
                .fontWeight(.semibold)
                .padding(.bottom, 20)
            
            Text("Last week I went to Beijing.I went there by train.It was fine with no rain.The sun was shining all the time")
        }
        .padding()
        .padding(.vertical, 10)
        .background(
            //把两个文字整体制作阴影
            Color.white
                .cornerRadius(20)  //圆角
                .shadow(color: Color.black.opacity(0.3), radius: 10, x: 0.0, y: 10)
        )
        .padding(.horizontal, 10)
        
        
    }
             
}

#Preview {
    SwiftUIView_Padding_Spacer()
}
